
//jsel
var jsel = {

    /***************************    
        Vars
    ***************************/
    
    sel:    null, //what's the point of this if IE and stuff will use it....
    range:  null,
    ranges: [],
    core:   function() {},
    
    /***************************    
        Init
    ***************************/
    
    init:   function() {
        this.getSel();
        this.getRange();
        return this;
    },
    
    /***************************    
        Get
    ***************************/    
    getSel: function() {
        this.sel = document.selection ||  window.getSelection();        
        
        return this;
    },

    getRange: function() {
        if(document.selection)
            this.range = document.selection.createRange() 
        else   
          this.range = this.sel.getRangeAt(0);          
          
        return this;
    },

    //ff only
    getRanges: function(n) {    
	    for(var i = 0; i < sel.rangeCount; i++) {
		    log(sel.getRangeAt(i))
		    this.ranges[i] = sel.getRangeAt(i);
	    }
    },       
    

    /***************************    
        Modify
    ***************************/   

    collapseToEndOfSelection: function() {
        this.sel.collapse( this.sel.focusNode,  this.sel.focusNode.nodeValue.length );
    },
    

    removeSelectedContents: function() {
        this.range.deleteContents();
    },
    

    /***************************    
        New
    ***************************/   

    selectNode: function(n) {
        this.sel.extend(sel.anchorNode, 1);	
        return this;
    },


    newRange: function() {},
    
    
    /***************************    
        Util
    ***************************/  
    log: function() {log(this);return this;}

}




var s = jsel.init();

log(s.getSel().log().getRange());
